package com.zlsy.secondtime.singleton;


import java.util.Objects;

/**
 * @author zhouliang
 * @date 2020/6/12 8:39
 * 单例模式-线程安全的懒汉式（不推荐使用效率很低）
 */
public class Singleton4 {

    private static Singleton4 INSTANCE = null;

    private Singleton4() {
    }

    public synchronized static Singleton4 getInstance() {
        if (Objects.isNull(INSTANCE)) {
            INSTANCE = new Singleton4();
        }
        return INSTANCE;
    }
}
